package com.basketball.gym.pojo;

import com.baomidou.mybatisplus.annotation.IdType;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;

/**
 * <p>
 *
 * </p>
 *
 * @author 赵肖云
 * @since 2021-03-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "Finance对象", description = "")
public class Finance implements Serializable {
    public interface adminUse{
    }

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "是否删除")
    @TableLogic
    private Integer deleted;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateAt;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createAt;

    @NotNull(message = "description不能为空",groups = {adminUse.class})
    @ApiModelProperty(value = "描述")
    private String description;

    @ApiModelProperty(value = "货币类型（1为金额，2为积分，3为入场券）")
    private Integer type;

    @ApiModelProperty(value = "收支类型（1为收入，2为支出）")
    private Integer paymentType;

    @NotNull(message = "sum不能为空",groups = {adminUse.class})
    @ApiModelProperty(value = "金额")
    private Double sum;

    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    @ApiModelProperty(value = "用户")
    @TableField(exist = false)
    private User user;

    @ApiModelProperty(value = "流水ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @TableField(exist = false)
    @JsonBackReference("当前页")
    @ApiModelProperty("当前页")
    private Integer current;

    @TableField(exist = false)
    @JsonBackReference("每页条数")
    @ApiModelProperty("每页条数")
    private Integer size;

    @NotNull(message = "phone不能为空",groups = {adminUse.class})
    @TableField(exist = false)
    @JsonBackReference("手机号")
    @ApiModelProperty("手机号")
    private String phone;

    public Finance() {
    }

    public Finance(String description, Integer type, Integer paymentType, Double sum, Integer userId) {
        this.description = description;
        this.type = type;
        this.paymentType = paymentType;
        this.sum = sum;
        this.userId = userId;
    }
}
